﻿using System;
using System.IO;
using paravili.Ui;
using Sebarf.Diagnostics.Interfaces;

namespace TestMotionByDifference {
	internal class Program {
		[STAThread]
		private static void Main(string[] args) {
			string file = string.Empty;
			if (args.Length > 0) {
				file = args[0];
			}
			else {
				string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.xaml");
				int index = 0;
				if (files.Length == 0) {
					Console.WriteLine("No configuration file exits.");
					return;
				}
				foreach (string f in files) {
					Console.WriteLine(string.Format("{0} :-> {1}", index, new FileInfo(f).Name));
					index++;
				}
				Console.WriteLine("Choose the configuration file from above");
				string answer = Console.ReadLine();
				try {
					index = int.Parse(answer);
					file = files[index];
				}
				catch (FormatException) {
					Logger.WriteWarning("no file has been chosen");
					return;
				}
			}
			new AlgorithmViewer(file, "MotionByDiffColors").ShowDialog();
		}
	}
}